<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListProductTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <p:panel header="Product">
                <h:form styleClass="jsfcrud_list_form">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListProductEmpty}" rendered="#{productController.items.rowCount == 0}"/>

                    <p:panel styleClass="image">




                        <h:panelGroup rendered="#{productController.items.rowCount > 0}">
                            <p:dataTable value="#{productController.items}" var="item"   style="border:solid 0px" id="tabela">

                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListProductTitle_ID}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.ID}"/>
                                </p:column>

                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListProductTitle_description}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.description}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListProductTitle_price}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.price}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListProductTitle_supply}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.supply}"/>
                                </p:column>

                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="&nbsp;"/>
                                    </f:facet>

                                    <p:commandButton action="#{productController.prepareEdit}" value="#{bundle.ListProductEditLink}" rendered="#{personController.logado}"/>
                                    <h:outputText value=" "/>
                                    <p:commandButton action="#{productController.destroy}" value="#{bundle.ListProductDestroyLink}" rendered="#{personController.logado}"/>
                                </p:column>
                            </p:dataTable>
                        </h:panelGroup>
                        <br />
                        <p:commandButton action="/paginas/software/Create" value="Novo Software" rendered="#{personController.logado}"/>
                        <br/>
                        <p:commandButton action="/paginas/hardware/Create" value="Novo Hardware" rendered="#{personController.logado}"/>
                        <br />
                        <br />
                        <h:link outcome="/home" value="#{bundle.ListProductIndexLink}"/>
                    </p:panel>
                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>
